package com.hoshiibuy.customerOperation.entity.param;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hoshiibuy.common.query.CommonParam;
import com.hoshiibuy.customerOperation.entity.Reviews;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 查询平台商品评价参数
 * </p>
 * 
 * @author Mr.Wu
 * @since 2019-04-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "查询平台商品评价", description = "查询平台商品评价")
public class ReviewsQueryParam extends CommonParam implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long id;

	@ApiModelProperty(value = "平台id")
	private Long platformId;

	@ApiModelProperty(value = "平台用户ID")
	private Long userId;

	@ApiModelProperty(value = "订单ID")
	private Long orderid;

	@ApiModelProperty(value = "平台SPUID")
	private Long platformSpuId;

	@ApiModelProperty(value = "平台SKUID")
	private Long platformSkuId;

	@ApiModelProperty(value = "商品评分 1-5个星")
	private Integer stars;

	@ApiModelProperty(value = "评论内容")
	private String contexts;

	@ApiModelProperty(value = "是否匿名评价")
	private Integer isAnonymous;

	@ApiModelProperty(value = "是否已经屏蔽或删除")
	private Integer deleted;

	public QueryWrapper<Reviews> getQueryWrapper() {
		QueryWrapper<Reviews> queryWrapper = new QueryWrapper<Reviews>();
		queryWrapper.eq(this.id != null, "id", this.id);
		queryWrapper.eq(this.platformId != null, "platform_id", this.platformId);
		queryWrapper.eq(this.userId != null, "user_id", this.userId);
		queryWrapper.eq(this.platformSpuId != null, "platform_spu_id", this.platformSpuId);
		queryWrapper.eq(this.platformSkuId != null, "platform_sku_id", this.platformSkuId);
		queryWrapper.eq(this.stars != null, "stars", this.stars);
		queryWrapper.eq(StringUtils.isNotBlank(this.contexts), "contexts", this.contexts);
		queryWrapper.eq(this.isAnonymous != null, "is_anonymous", this.isAnonymous);
		queryWrapper.eq(this.deleted != null, "deleted", this.deleted);
		return queryWrapper;
	}
}
